const options = [{
  text: '水果',
  value: 'fruit',
  children: [{
      text: '红富士苹果',
      value: 'red-fuji'
    },
    {
      text: '黄元帅苹果',
      value: 'yellow-apple'
    },
    {
      text: '绿富士苹果',
      value: 'green-fuji'
    },
    {
      text: '蛇果',
      value: 'snake-fruit'
    },
    {
      text: '青苹果',
      value: 'green-apple'
    },
    {
      text: '香蕉',
      value: 'banana'
    },
    {
      text: '橙子',
      value: 'orange'
    },
    {
      text: '西瓜',
      value: 'watermelon'
    },
    {
      text: '草莓',
      value: 'strawberry'
    },
    {
      text: '葡萄',
      value: 'grape'
    },
  ],
},
{
  text: '蔬菜',
  value: 'vegetable',
  children: [{
      text: '黄瓜',
      value: 'cucumber'
    },
    {
      text: '番茄',
      value: 'tomato'
    },
    {
      text: '土豆',
      value: 'potato'
    },
    {
      text: '胡萝卜',
      value: 'carrot'
    },
    {
      text: '白菜',
      value: 'cabbage'
    },
    {
      text: '菠菜',
      value: 'spinach'
    },
    {
      text: '生菜',
      value: 'lettuce'
    },
    {
      text: '茄子',
      value: 'eggplant'
    },
    {
      text: '西兰花',
      value: 'broccoli'
    },
    {
      text: '辣椒',
      value: 'pepper'
    },
  ],
},
{
  text: '谷物',
  value: 'grain',
  children: [{
      text: '小麦',
      value: 'wheat'
    },
    {
      text: '大米',
      value: 'rice'
    },
    {
      text: '玉米',
      value: 'corn'
    },
    {
      text: '大豆',
      value: 'soybean'
    },
    {
      text: '燕麦',
      value: 'oat'
    },
    {
      text: '高粱',
      value: 'sorghum'
    },
    {
      text: '大麦',
      value: 'barley'
    },
    {
      text: '黑米',
      value: 'black-rice'
    },
    {
      text: '红豆',
      value: 'red-bean'
    },
    {
      text: '绿豆',
      value: 'green-bean'
    },
  ],
},
{
  text: '坚果',
  value: 'nut',
  children: [{
      text: '花生',
      value: 'peanut'
    },
    {
      text: '杏仁',
      value: 'almond'
    },
    {
      text: '核桃',
      value: 'walnut'
    },
    {
      text: '腰果',
      value: 'cashew'
    },
    {
      text: '开心果',
      value: 'pistachio'
    },
    {
      text: '松子',
      value: 'pine-nut'
    },
    {
      text: '榛子',
      value: 'hazelnut'
    },
    {
      text: '栗子',
      value: 'chestnut'
    },
    {
      text: '葵花籽',
      value: 'sunflower-seed'
    },
    {
      text: '南瓜子',
      value: 'pumpkin-seed'
    },
  ],
},
{
  text: '豆类',
  value: 'legume',
  children: [{
      text: '红豆',
      value: 'red-bean'
    },
    {
      text: '绿豆',
      value: 'green-bean'
    },
    {
      text: '黑豆',
      value: 'black-bean'
    },
    {
      text: '芸豆',
      value: 'kidney-bean'
    },
    {
      text: '鹰嘴豆',
      value: 'chickpea'
    },
    {
      text: '四季豆',
      value: 'string-bean'
    },
    {
      text: '豌豆',
      value: 'pea'
    },
    {
      text: '小扁豆',
      value: 'lentil'
    },
    {
      text: '蚕豆',
      value: 'broad-bean'
    },
    {
      text: '毛豆',
      value: 'edamame'
    },
  ],
},
];

Page({
data: {
  show: false,
  options,
  fieldValue: '',
  cascaderValue: '',
  value: '',
},

onClick() {
  this.setData({
    show: true,
  });
},

onClose() {
  this.setData({
    show: false,
  });
},

onFinish(e) {
  const {
    selectedOptions,
    value
  } = e.detail;
  const fieldValue = selectedOptions
    .map((option) => option.text || option.name)
    .join('/');
  this.setData({
    fieldValue,
    cascaderValue: value,
  });
},

onChange(event) {
  // event.detail 为当前输入的值
  console.log(event.detail);
  this.setData({
    value: event.detail,
  });
},

nextbutton:function(){
  wx.navigateTo({
    url: '/pages/serve-zhunong/serve-zhunong'
  })
}
});